import request from '../request'

export default {
  /* 修改用户信息 */
  //获取用户信息
  getUserInfo() {
    return request({
      url: '/api/core/get_user_info',
      method: 'get',
    })
  },
  //更改用户信息
  updataUser(data) {
    return request({
      url: '/api/core/update_user_info',
      method: 'put',
      data: data,
    })
  },

  /* 修改头像 */
  updataAvatar(data) {
    return request({
      url: '/api/core/update_avatar',
      method: 'put',
      data: data,
    })
  },

  /* 我的收藏 */
  //获取收藏
  getCollect(currentPage, pageSize) {
    return request({
      url:
        '/api/core/video_operation/get_collection_records_detail/' +
        currentPage +
        '/' +
        pageSize,
      method: 'get',
    })
  },

  /* 修改密码 */
  //发送验证码
  sendCode() {
    return request({
      url: '/api/cms/send_password_email',
      method: 'get',
    })
  },
  //检查验证码
  checkCode(code) {
    return request({
      url: '/api/core/check_update_password_code/' + code,
      method: 'get',
    })
  },
  //更改用户密码
  updateUserPassWord(code, password) {
    return request({
      url: '/api/core/update_password/' + code,
      method: 'put',
      data: password,
      headers: {
        'Content-Type': 'application/json',
      },
    })
  },

  /* 我的记录 */
  //获取播放记录
  getPlayRecode() {
    return request({
      url: '/api/core/video_operation/get_play_records_detail',
      method: 'get',
    })
  },
  //删除播放记录
  delRecode(id) {
    return request({
      url: '/api/core/video_operation/delete_play_records/' + id,
      method: 'delete',
    })
  },
  delAllRecode() {
    return request({
      url: '/api/core/video_operation/delete_all_play_records',
      method: 'delete',
    })
  },

  /* 发布视频 */
  //发布视频
  publishVideo(formData) {
    return request({
      url: '/api/core/add_video',
      method: 'post',
      data: formData,
      /* headers: {
        'Content-Type': 'multipart/form-data',
      }, */
    })
  },
}
